package com.ty.day3;

import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : txy
 * @Create 2023/10/30 11:18
 */
public class Two {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x, a = 1;
        System.out.print("请输入一个整数：");
        x = sc.nextInt();
        if (x % 2 == 0) {
            a = 2;
        }
        double sum = 0;
        while (a <= x) {
            sum = sum + 1.0 / a;
            a += 2;
        }
        System.out.println(sum);

    }
}
